package com.dk.data;

import com.dk.em.ResultEnum;

public class Result<T> {
    private Integer code;
    private String message;
    private T data;

    public static Result response(ResultEnum resultEnum){
        Result result = new Result();
        result.setCode(resultEnum.getCode());
        result.setMessage(resultEnum.getMessage());
        return result;
    }
    public static Result FALLEOVER(){
        Result result = new Result();
        result.setCode(ResultEnum.FALL_ERROR.getCode());
        result.setMessage(ResultEnum.FALL_ERROR.getMessage());
        return result;
    }

    public static Result ok(){
        Result result = new Result();
        result.setCode(ResultEnum.SUCCESS.getCode());
        result.setMessage(ResultEnum.SUCCESS.getMessage());
        return result;
    }


    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public T getData() {
        return data;
    }

    public Result setData(T data) {
        this.data = data;
        return this;
    }
}
